import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        int[][] arr = {
                {1, 2, 3, 4},
                {5, 6, 7, 8},
                {9, 10, 11, 12}
        };
        for (int row = 0; row < arr.length; row++) {
            for (int col = 0; col < arr[row].length; col++) {
                System.out.printf("%d\t", arr[row][col]);
            }
            System.out.println("");
        }
    }
    public static void main12(String[] args) {
        int[]arr={1,2,3,4,5,6,7};
        System.out.println(Arrays.toString(arr));
        System.out.println("==========");
        int[]arr1={2,41,23,12,51,56,2,1};
        Arrays.sort(arr1);
        System.out.println(Arrays.toString(arr1));
    }
    public static void BubbleSort(int[]arr){
        for(int i=0;i<arr.length;i++){
            boolean flag=false;
            for(int j=0;j< arr.length-i-1;j++){
                if(arr[j]>arr[j+1]){
                    int tmp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=tmp;
                    flag=true;
                }
            }
            if(flag==false){
                return;
            }
        }
    }
    public static void main11(String[] args) {
        int[]arr={2,31,4,5,1,10};
        for(int i=0;i<arr.length;i++){
            System.out.print(arr[i]+" ");
        }
        BubbleSort(arr);
        System.out.println("======");
        for(int i=0;i<arr.length;i++){
            System.out.print(arr[i]+" ");
        }
    }
    public static int BinarySearcher(int[]arr,int key){
        int left=0;
        int right=arr.length-1;
        while (left<=right){
            int mid=(left+right)/2;
            if(arr[mid]>key){
                right=mid-1;
            } else if (arr[mid]<key) {
                left=mid+1;
            }else {
                return mid;
            }
        }
        return -1;
    }
    public static void main10(String[] args) {
        int[]arr={1,2,3,4,5};
        int ret=BinarySearcher(arr,4);
        System.out.println(ret);
    }
    public static int[] copyArr(int[]arr){
        int[]tmp=new int[arr.length];
        for (int i = 0; i < arr.length; i++) {
            tmp[i]=arr[i];
        }
        return tmp;
    }

    public static void main9(String[] args) {
        int[]arr={1,2,3,4,5};
        int[]ret=copyArr(arr);
        for(int i=0;i<ret.length;i++){
            System.out.println(ret[i]);
        }
    }
    public static int[]func1(int[]arr1){
        for (int i = 0; i < arr1.length; i++) {
            arr1[i]*=2;
        }
        return arr1;
    }
    public static void main8(String[] args) {
        int[]arr=new int[]{1,2,3,4,5};
        int[]ret=func1(arr);
        for (int i = 0; i < ret.length; i++) {
            System.out.println(ret[i]);
        }
    }
    public static void main7(String[] args) {
        int[]arr={1,2,3};
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
    public static void main6(String[] args) {
        int[]arr=null;
        System.out.println(arr[0]);
    }
    public static void func() {
        int[] array1 = new int[3];
        array1[0] = 10;
        array1[1] = 20;
        array1[2] = 30;
        int[] array2 = new int[]{1,2,3,4,5};
        array2[0] = 100;
        array2[1] = 200;
        array1 = array2;
        array1[2] = 300;
        array1[3] = 400;
        array2[4] = 500;
        for (int i = 0; i < array2.length; i++) {
            System.out.println(array2[i]);
        }
    }
    public static void main5(String[] args) {
        func();
    }
    public static void main4(String[] args) {
        int[]arr=new int[]{1,2,3};
        System.out.println(arr);
    }
    public static void main3(String[] args) {
        int[]arr={1,2,3,4,5,6,7,8,9,10};
        System.out.println(arr[0]);
        System.out.println(arr[1]);
        System.out.println(arr[2]);
        System.out.println(arr[3]);
        //System.out.println(arr[10]);
        for (int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        for(int x:arr){
            System.out.println(x);
        }
    }
    public static void main2(String[] args) {

        /*double[]brr=new double[5];
        String[]crr=new String[10];*/
        int []arr1=new int[]{1,2,3,4,5};
        int []arr2={1,2,3,4,5};
    }
    public static void main1(String[] args) {
        int score1=100;
        int score2=80;
        int score3=72;
        int score4=29;
        int score5=83;
        System.out.println(score1);
        System.out.println(score2);
        System.out.println(score3);
        System.out.println(score4);
        System.out.println(score5);
    }
}